﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Options;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Commands
{
    public abstract class CodeAnalysisCommandBase : CommandBase<CodeAnalysisCommandExecutionContext>
    {
        private GeneralOption option;


        protected CodeAnalysisCommandBase(IUnityContainer container)
            : base(container)
        {
            var package = container.Resolve<IFxCopIntegratorPackage>();
            option = package.GeneralOption;
        }


        protected bool ShouldInspect()
        {
            return option.IntegratedCodeAnalysisCommandBehavior.HasFlag(IntegratedCodeAnalysisCommandBehaviors.Inspect);
        }

        protected bool ShouldCalculateMetrics()
        {
            return option.IntegratedCodeAnalysisCommandBehavior.HasFlag(IntegratedCodeAnalysisCommandBehaviors.CalculateMetrics);
        }
    }
}
